package com.hb.resource.pojo.domain;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author hb
 * @date 2023/7/9
 */
@Data
public class Library implements Serializable {


    /**
     * query : http://archive.org/advancedsearch.php?q=openlibrary_work%3A%28%2A%29+AND+%28collection%3A%28inlibrary%29+OR+%28%21collection%3A%28printdisabled%29%29%29+AND+%28lending___available_to_browse%3Atrue+OR+lending___available_to_borrow%3Atrue%29+AND+openlibrary_subject%3Atextbooks&fl%5B%5D=identifier&fl%5B%5D=openlibrary_edition&fl%5B%5D=openlibrary_work&rows=1&page=1&output=json&service=metadata__unlimited&sort%5B%5D=lending___last_browse+desc
     * works : [{"publishers":["Willard Grant Press"],"identifiers":{"librarything":["971110"],"goodreads":["4375659"]},"ia_box_id":["IA106301"],"covers":[7170952],"local_id":["urn:mgc:31927000164126"],"ia_loaded_id":["organicchemistry00fess"],"lc_classifications":["QD251.2 .F49 1982"],"key":"/books/OL4267488M","authors":[{"key":"/authors/OL401050A"}],"ocaid":"organicchemistry00fess","publish_places":["Boston, Massachusetts"],"contributions":["Fessenden, Joan S."],"subjects":["Chemistry, Organic."],"languages":[{"key":"/languages/eng"}],"pagination":"xvii, 1069 p.","classifications":{},"source_records":["ia:organicchemistry00fess","marc:marc_marygrove/marygrovecollegelibrary.full.D20191108.T213022.internetarchive2nd_REPACK.mrc:81892865:1820","marc:marc_loc_2016/BooksAll.2016.part13.utf8:92688149:663","amazon:0871507528"],"title":"Organic chemistry","lccn":["81013496"],"notes":"Includes index.","number_of_pages":1069,"edition_name":"2nd ed.","dewey_decimal_class":["547"],"isbn_10":["0871507528","0534980090"],"publish_date":"1982","publish_country":"mau","by_statement":"Ralph J. Fessenden, Joan S. Fessenden.","works":[{"key":"/works/OL2736301W"}],"type":{"key":"/type/edition"},"latest_revision":11,"revision":11,"created":{"type":"/type/datetime","value":"2008-04-01T03:28:50.625462"},"last_modified":{"type":"/type/datetime","value":"2022-10-28T02:31:25.573646"},"availability":{"status":"borrow_available","available_to_browse":true,"available_to_borrow":true,"available_to_waitlist":false,"is_printdisabled":true,"is_readable":false,"is_lendable":true,"is_previewable":true,"identifier":"organicchemistry00fess","isbn":"0871507528","oclc":null,"openlibrary_work":"OL2736301W","openlibrary_edition":"OL4267488M","last_loan_date":"2020-09-01T13:06:42Z","num_waitlist":"0","last_waitlist_date":"2019-12-02T07:48:32Z","is_restricted":true,"is_browseable":true,"__src__":"core.models.lending.get_availability"}}]
     */

    private String query;
    private List<WorksBeanX> works;

    public static Library objectFromData(String str) {

        return new com.google.gson.Gson().fromJson(str, Library.class);
    }

    @Data
    public static class WorksBeanX implements Serializable {
        /**
         * publishers : ["Willard Grant Press"]
         * identifiers : {"librarything":["971110"],"goodreads":["4375659"]}
         * ia_box_id : ["IA106301"]
         * covers : [7170952]
         * local_id : ["urn:mgc:31927000164126"]
         * ia_loaded_id : ["organicchemistry00fess"]
         * lc_classifications : ["QD251.2 .F49 1982"]
         * key : /books/OL4267488M
         * authors : [{"key":"/authors/OL401050A"}]
         * ocaid : organicchemistry00fess
         * publish_places : ["Boston, Massachusetts"]
         * contributions : ["Fessenden, Joan S."]
         * subjects : ["Chemistry, Organic."]
         * languages : [{"key":"/languages/eng"}]
         * pagination : xvii, 1069 p.
         * classifications : {}
         * source_records : ["ia:organicchemistry00fess","marc:marc_marygrove/marygrovecollegelibrary.full.D20191108.T213022.internetarchive2nd_REPACK.mrc:81892865:1820","marc:marc_loc_2016/BooksAll.2016.part13.utf8:92688149:663","amazon:0871507528"]
         * title : Organic chemistry
         * lccn : ["81013496"]
         * notes : Includes index.
         * number_of_pages : 1069
         * edition_name : 2nd ed.
         * dewey_decimal_class : ["547"]
         * isbn_10 : ["0871507528","0534980090"]
         * publish_date : 1982
         * publish_country : mau
         * by_statement : Ralph J. Fessenden, Joan S. Fessenden.
         * works : [{"key":"/works/OL2736301W"}]
         * type : {"key":"/type/edition"}
         * latest_revision : 11
         * revision : 11
         * created : {"type":"/type/datetime","value":"2008-04-01T03:28:50.625462"}
         * last_modified : {"type":"/type/datetime","value":"2022-10-28T02:31:25.573646"}
         * availability : {"status":"borrow_available","available_to_browse":true,"available_to_borrow":true,"available_to_waitlist":false,"is_printdisabled":true,"is_readable":false,"is_lendable":true,"is_previewable":true,"identifier":"organicchemistry00fess","isbn":"0871507528","oclc":null,"openlibrary_work":"OL2736301W","openlibrary_edition":"OL4267488M","last_loan_date":"2020-09-01T13:06:42Z","num_waitlist":"0","last_waitlist_date":"2019-12-02T07:48:32Z","is_restricted":true,"is_browseable":true,"__src__":"core.models.lending.get_availability"}
         */

        private IdentifiersBean identifiers;
        private String key;
        private String ocaid;
        private String pagination;
        private ClassificationsBean classifications;
        private String title;
        private Object notes;
        private int number_of_pages;
        private String edition_name;
        private String publish_date;
        private String publish_country;
        private String by_statement;
        private TypeBean type;
        private int latest_revision;
        private int revision;
        private CreatedBean created;
        private LastModifiedBean last_modified;
        private AvailabilityBean availability;
        private List<String> publishers;
        private List<String> ia_box_id;
        private List<Integer> covers;
        private List<String> local_id;
        private List<String> ia_loaded_id;
        private List<String> lc_classifications;
        private List<AuthorsBean> authors;
        private List<String> publish_places;
        private List<String> contributions;
        private List<String> subjects;
        private List<LanguagesBean> languages;
        private List<String> source_records;
        private List<String> lccn;
        private List<String> dewey_decimal_class;
        private List<String> isbn_10;
        private List<WorksBean> works;

        public static WorksBeanX objectFromData(String str) {

            return new com.google.gson.Gson().fromJson(str, WorksBeanX.class);
        }

        @Data
        public static class IdentifiersBean implements Serializable {
            public static IdentifiersBean objectFromData(String str) {

                return new com.google.gson.Gson().fromJson(str, IdentifiersBean.class);
            }
        }

        @Data
        public static class ClassificationsBean implements Serializable {
            public static ClassificationsBean objectFromData(String str) {

                return new com.google.gson.Gson().fromJson(str, ClassificationsBean.class);
            }
        }

        @Data
        public static class TypeBean implements Serializable {
            /**
             * key : /type/edition
             */

            private String key;

            public static TypeBean objectFromData(String str) {

                return new com.google.gson.Gson().fromJson(str, TypeBean.class);
            }
        }

        @Data
        public static class CreatedBean implements Serializable {
            /**
             * type : /type/datetime
             * value : 2008-04-01T03:28:50.625462
             */

            private String type;
            private String value;

            public static CreatedBean objectFromData(String str) {

                return new com.google.gson.Gson().fromJson(str, CreatedBean.class);
            }
        }

        @Data
        public static class LastModifiedBean implements Serializable {
            /**
             * type : /type/datetime
             * value : 2022-10-28T02:31:25.573646
             */

            private String type;
            private String value;

            public static LastModifiedBean objectFromData(String str) {

                return new com.google.gson.Gson().fromJson(str, LastModifiedBean.class);
            }
        }

        @Data
        public static class AvailabilityBean implements Serializable {
            /**
             * status : borrow_available
             * available_to_browse : true
             * available_to_borrow : true
             * available_to_waitlist : false
             * is_printdisabled : true
             * is_readable : false
             * is_lendable : true
             * is_previewable : true
             * identifier : organicchemistry00fess
             * isbn : 0871507528
             * oclc : null
             * openlibrary_work : OL2736301W
             * openlibrary_edition : OL4267488M
             * last_loan_date : 2020-09-01T13:06:42Z
             * num_waitlist : 0
             * last_waitlist_date : 2019-12-02T07:48:32Z
             * is_restricted : true
             * is_browseable : true
             * __src__ : core.models.lending.get_availability
             */

            private String status;
            private boolean available_to_browse;
            private boolean available_to_borrow;
            private boolean available_to_waitlist;
            private boolean is_printdisabled;
            private boolean is_readable;
            private boolean is_lendable;
            private boolean is_previewable;
            private String identifier;
            private String isbn;
            private Object oclc;
            private String openlibrary_work;
            private String openlibrary_edition;
            private String last_loan_date;
            private String num_waitlist;
            private String last_waitlist_date;
            private boolean is_restricted;
            private boolean is_browseable;
            private String __src__;

            public static AvailabilityBean objectFromData(String str) {

                return new com.google.gson.Gson().fromJson(str, AvailabilityBean.class);
            }
        }

        @Data
        public static class AuthorsBean implements Serializable {
            /**
             * key : /authors/OL401050A
             */

            private String key;

            public static AuthorsBean objectFromData(String str) {

                return new com.google.gson.Gson().fromJson(str, AuthorsBean.class);
            }
        }

        @Data
        public static class LanguagesBean implements Serializable {
            /**
             * key : /languages/eng
             */

            private String key;

            public static LanguagesBean objectFromData(String str) {

                return new com.google.gson.Gson().fromJson(str, LanguagesBean.class);
            }
        }

        @Data
        public static class WorksBean implements Serializable {
            /**
             * key : /works/OL2736301W
             */

            private String key;

            public static WorksBean objectFromData(String str) {

                return new com.google.gson.Gson().fromJson(str, WorksBean.class);
            }
        }
    }

    @Override
    public String toString() {
        return "Library{" +
                "query='" + query + '\'' +
                ", works=" + works +
                '}';
    }
}
